package hanjoapp.server;

import hanjoapp.client.User;
import hanjoapp.client.LoginService;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyService;

/**
 * The server side implementation of the RPC service.
 */
@SuppressWarnings("serial")
public class LoginServiceImpl extends RemoteServiceServlet implements
		LoginService {

	
	public Boolean loginServer(String login, String password) throws IllegalArgumentException {
		// Verify that the input is valid. 
		ObjectifyService.register(User.class);
        Objectify ofy = ObjectifyService.begin();
        User user = ofy.query(User.class).filter("login", login).get();
        if (user.getPassword().equals(password)) {
        	
        	return true;
        }
        return false;
	}
}
